<!DOCTYPE html>
<html>
<head>
    <title>Show Books</title>
    <meta charset="UTF-8"/>
    <link type="text/css" href="css/style.css" rel="stylesheet"/>
    <style type="text/css">
        #block {
            display: inline-block;
        }
    </style>
</head>
<body>

<?php
/**
 * Created by JetBrains PhpStorm.
 * User: GJN
 * Date: 5/7/13
 * Time: 3:26 AM
 */

include_once("models/DbConnect.php");

/**
 * Lấy dữ liệu từ database
 */
$sql = "SELECT * FROM books ORDER BY title ASC";
$query = mysql_query($sql);
if (mysql_num_rows($query) > 0) {
    while ($row = mysql_fetch_array($query)) {
        ?>
        <div class='pro' id='block'>
            <h3><?= $row['title'] ?></h3>
            Tác giả: <?= $row['author'] ?> Giá: <?= number_format($row['price'], 3) ?>VNĐ<br/>

            <p><a href="addcart.php?item=<?= $row['id'] ?>">Mua sách</a></p>
        </div>
    <?php
    }
} else {
    echo "<div class='pro'>Không có quyển sách nào trong database.</div>";
}
?>
</body>
</html>